<!--我的投标-->
<template>
	<view class="tender-page">
		<jhj-header class="page-header" :list="filterList" @click="goSortPage" @search-click="goSearchPage"></jhj-header>
		<view class="content">
			<you-scroll ref="scroll" :fetch="getTenderData">
				<view slot-scope="{row,index}" @click="goDetailPage(row,index)">
					<tender-list-item :item="row"></tender-list-item>
				</view>
			</you-scroll>
		</view>
	</view>
</template>

<script>
	import JhjHeader from '@/components/jhj-header/jhj-header.vue'
	import TenderListItem from './components/TenderListItem.vue'
	import youScroll from '@/components/uni-list-scroll/you-scroll'
	import {
		getTenderList
	} from '@/static/js/api/tender.js';
	export default {
		components: {
			JhjHeader,
			TenderListItem,
			youScroll
		},
		data() {
			return {
				filterList: [{
					name: '资格审查'
				}, {
					name: '开标评审'
				}, {
					name: '全部分类'
				}]
			}
		},
		mounted() {
			this.$refs.scroll.loadData();
		},
		methods: {
			getTenderData(pageIndex , pageSize) {
				let userInfo = JSON.parse(uni.getStorageSync('userInfo'));
				let domain = `[('user_id','=',${userInfo.uid})]`
				return getTenderList(pageIndex-1, pageSize, domain).then(res => {
					return res.data;
				})
			},
			goSortPage(item) {
				uni.navigateTo({
					url: `/pages/home/tender/TenderSortPage?state=${item.name}`
				})
			},
			goSearchPage() {
				uni.navigateTo({
					url: '/pages/home/tender/TenderSearchPage'
				})
			},
			goDetailPage(item, index) {
				uni.navigateTo({
					url: `/pages/home/tender/TenderDetailPage?id=${item.id}`
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.tender-page {
		height: 100vh;
		position: relative;
		overflow: hidden;
	}

	.page-header {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
	}

	.content {
		height: calc(100% - 140rpx);
		margin-top: 140rpx;
		background: #F4F5F9;
	}
</style>
